﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace SqlserverSessionDemo.Controllers
{
    public class AccountController : Controller
    {
        //
        // GET: /Account/

        public ActionResult Index()
        {
            return View();
        }


        [HttpPost]
        public ActionResult Login()
        {
            FormsAuthentication.SetAuthCookie("TestUser", true);

            var url = FormsAuthentication.GetRedirectUrl("TestUser", true);

            return Redirect(url);
        }

        public ActionResult Logout()
        {
            FormsAuthentication.SignOut();
            return RedirectToAction("Index");
        }

    }
}
